package me.exchange.com.modules.quartz.domain;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author Zheng Jie
 * @date 2019-01-07
 */
@Getter
@Setter
@Entity
@Table(name = "sys_quartz_job")
@org.hibernate.annotations.Table(appliesTo = "sys_quartz_job",comment="定时任务表")
public class QuartzJob  implements Serializable {

    public static final String JOB_KEY = "JOB_KEY";

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @NotNull(groups = {Update.class})
    @ApiModelProperty(name = "id",value = "ID")
    private Long id;

    /** 定时器名称 */
    @Column(name = "job_name")
    @ApiModelProperty(name = "jobName",value = "定时器名称",required = false)
    private String jobName;

    /** Bean名称 */
    @Column(name = "bean_name")
    @NotBlank
    @ApiModelProperty(name = "beanName",value = "bean名称",required = false)
    private String beanName;

    /** 方法名称 */
    @Column(name = "method_name")
    @NotBlank
    @ApiModelProperty(name = "methodName",value = "方法名称",required = false)
    private String methodName;

    /** 参数 */
    @Column(name = "params")
    @ApiModelProperty(name = "params",value = "参数",required = false)
    private String params;

    /** cron表达式 */
    @Column(name = "cron_expression")
    @NotBlank
    @ApiModelProperty(name = "cronExpression",value = "cron表达式")
    private String cronExpression;

    /** 状态 */
    @Column(name = "is_pause")
    @ApiModelProperty(name = "isPause",value = "状态",required = false)
    private Boolean isPause = false;

    /** 备注 */
    @Column(name = "remark")
    @NotBlank
    @ApiModelProperty(name = "remark",value = "备注",required = false)
    private String remark;

    /** 创建日期*/
    @Column(name = "create_time")
    @CreationTimestamp
    @ApiModelProperty(name = "createTime",value = "创建日期",required = false)
    private Timestamp createTime;

    public @interface Update {}
}